home *** CD-ROM | disk | FTP | other *** search
/ EuroCD 3 / EuroCD 3.iso / Programming / Amos / AMOSList-1297 / AMOSLIST / text0015.txt < prev    next >
Encoding:
Text File  |  1998-06-24  |  1.7 KB  |  52 lines

  1.  
  2.    Amazing isn't?  How you can write something and then later take a
  3.    look at it and the foolishness is no very obvious...
  4.  
  5.    In my previous reply to the collision-detection I made a rather  
  6.    stupid design, resulting in the collision-detection being MUCH
  7.    slower than it should be, not quite sure what happened there, 
  8.    sorry.  :)
  9.  
  10.    Anyway, the new design is:
  11.  
  12.    For OBJECT1=0 To 10
  13.       If Bob Col(OBJECT1, OBJECT1+1 To 11)
  14.          For OBJECT2=OBJECT1+1 To 11
  15.             If Col(OBJECT2)
  16.                Rem  Objects OBJECT1 and OBJECT2 have collided, so
  17.                Rem  do your collision-processing here...
  18.             End If
  19.          Next OBJECT2      
  20.       End If
  21.    Next OBJECT1
  22.  
  23.    Now, THAT IS AN OPTIMIZED DESIGN!!!!
  24.    
  25.    The advantages over the first one:
  26.   
  27.    1.  The MAIN advantage is that each collision between any two
  28.         objects is only performed once so we only need a total of 66
  29.         Col checks, AND these Col checks are only performed if
  30.         AMOS has detected a collison, so it should be VERY FAST.
  31.    2.  The actual loop-processing is very tiny which means it will be
  32.         quite fast.
  33.    3.  We're no longer utilizing an external Procedure call, which also
  34.         makes this version a bit faster.
  35.  
  36.    Finally, the whole thing is highly stream-lined and is the essence of
  37.    creating an optimized design!!
  38.  
  39.    If this doesn't speed up your game then the problem MUST be
  40.    something other than the collision-detection...
  41.  
  42.    Let me know what the new frame-rate is!!
  43.  
  44.  
  45.       Take  care,   
  46.       GARFIELD
  47.       _________________________
  48.       Current projects...
  49.       SideShooter(AMOS): 85% Complete
  50.       Website(http://www.sosbbs.com/~gbenjam): 20% Complete
  51.  
  52.